using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace Dogfight2008.Tests
{
  [TestFixture]
  public class PlaneControlFixture
  {
    PlaneControl pc = null;

    [SetUp]
    public void Init()
    {
      pc = new PlaneControl();
    }

    [Test]
    public void Construct()
    {
    }

    [Test]
    public void InitialStickPosition()
    {
      Assert.AreEqual(StickPosition.Neutral, pc.StickPosition);
    }

    [Test]
    public void KeyDiveDownOnce()
    {
      pc.DivePushed();
      Assert.AreEqual(StickPosition.Dive, pc.StickPosition);
    }

    [Test]
    public void KeyDiveDownThenUp()
    {
      pc.DivePushed();
      pc.DiveReleased();
      Assert.AreEqual(StickPosition.Neutral, pc.StickPosition);
    }

    [Test]
    public void DivePushedThenLift()
    {
      pc.DivePushed();
      pc.LiftPushed();
      Assert.AreEqual(StickPosition.Lift, pc.StickPosition);
    }

    [Test]
    public void DiveLiftPushedLiftReleased()
    {
      pc.DivePushed();
      pc.LiftPushed();
      pc.LiftReleased();
      Assert.AreEqual(StickPosition.Dive, pc.StickPosition);
    }

    [Test]
    public void DivePushedTwice()
    {
      pc.DivePushed();
      pc.DivePushed();
      Assert.AreEqual(StickPosition.Dive, pc.StickPosition);
    }

    [Test]
    public void Lift()
    {
      pc.LiftPushed();
      Assert.AreEqual(StickPosition.Lift, pc.StickPosition);
    }

    [Test]
    public void DiveLiftThenBothReleased()
    {
      pc.DivePushed();
      pc.LiftPushed();
      pc.DiveReleased();
      pc.LiftReleased();
      Assert.AreEqual(StickPosition.Neutral, pc.StickPosition);
    }
  }
}
